package chapter67;
/*
 * 给我一个学员数组，如果有学员的成绩小于60分，则将集体成员的成绩提高2分
 */
public class ModifyScore {
	public void modifyScore(Students[] stus){
		boolean flag = false;
		for (int i = 0; i < stus.length; i++) {
			if (stus[i].score<60){
				flag = true;
				break;
			}
		}
		if (flag){
			for (int i = 0; i < stus.length; i++) {
				stus[i].score += 2;
			}
		}
	}
	public static void main(String[] args) {
		ModifyScore ms = new ModifyScore();
		Students[] stus = new Students[2];
		
		Students stu1 = new Students();
		stu1.studentName = "张三";
		stu1.classes = 2;
		stu1.studentAge = 14;
		stu1.hobby = "网球";
		stu1.score = 98;
		
		Students stu2 = new Students();
		stu2.studentName = "李四";
		stu2.studentAge = 14;
		stu2.classes = 3;
		stu2.hobby = "篮球";
		stu2.score = 34;
		
		stus[0] = stu1;
		stus[1] = stu2;
		
		
		ms.modifyScore(stus);
		System.out.println("修改后的分数为：");
		for (Students stu:stus){
			System.out.println(stu.studentName+"--->"+stu.score);
		}
	}

}
